﻿@model IEnumerable<Message>
@Html.Extra()
<table>
    <thead>
        <tr>
            <th>类型</th>
            <th>标题</th>
            <th>内容</th>
            <th>发送人</th>
            <th>接收人</th>
            <th>创建时间</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
        {
            <tr id="@item.Id">
                <td>
                    @item.Type.ToText()
                </td>
                <td>
                    @item.Title
                </td>
                <td>
                    @item.Content
                </td>
                <td>
                    @{
            var sUserName = "";

            if (item.SenderId.HasValue)
            {
                var sUser = CommonAppService.Current.GetUser(item.SenderId.Value);

                if (sUser != null)
                {
                    sUserName = sUser.UserName;
                }
            }
                    }

                    @sUserName
                </td>
                <td>
                    @{
            var rUserName = "";

            if (item.SenderId.HasValue)
            {
                var rUser = CommonAppService.Current.GetUser(item.ReceiverId.Value);

                if (rUser != null)
                {
                    rUserName = rUser.UserName;
                }
            }
                    }

                    @rUserName
                </td>
                <td>
                    @StringHelper.FormatDateAndTime(item.CreateTime)
                </td>
            </tr>
        }
    </tbody>
</table>
